<!DOCTYPE html>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <title>注册</title>
    <link rel="stylesheet" href="/static/css/weui.css" />
    <link rel="stylesheet" href="/static/css/example.css" />
    <style type="text/css">
        .center-in-center {
            position: absolute;
            top: 10%;
            left: 28%;
        }
         .center-in-center1 {
            position: absolute;
            top: 23%;
            left: 28%;
        }
         .center-in-center2 {
            position: absolute;
            top: 38%;
            left: 28%;
        }
        
        .center-in-top {
            position: absolute;
            top: 5%;
            left: 8%;
            width: 120%;
        }
        .center-in-top1 {
            position: absolute;
            top: 18%;
            left: 8%;
            width: 120%;
        }
        .center-in-top2 {
            position: absolute;
            top: 33%;
            left: 8%;
            width: 120%;
        }
        
        .center-in-bottom {
            position: absolute;
            top: 50%;
            left: 25.6%;
        }
        .center-in-bottom2 {
            position: absolute;
            top: 60%;
            left: 40%;
        }
    </style>
</head>

<body ontouchstart>
    <div class="container" id="container"></div>
    <script type="text/html" id="tpl_home">
        <div class="page">

            <div class="center-in-top1"><label style="font-size: 24px;color: rgba(0,0,0);">认证号码：</label></div>
            <div class="center-in-center1">
                <input id="cerNumber" class="weui-input" style="font-size: 30px" type="number" pattern="[0-9]*" placeholder="请输入认证号码" />
            </div>
            <!-- <div class="center-in-top1"><label style="font-size: 24px;color: rgba(0,0,0);">社区标识码：</label></div>
            <div class="center-in-center1">
                <input id="commuNum" class="weui-input" style="font-size: 30px" type="number" pattern="[0-9]*" placeholder="社区认证号码" />
            </div>
            <div class="center-in-top2"><label style="font-size: 24px;color: rgba(0,0,0);">设备标识码：</label></div>
            <div class="center-in-center2">
                <input id="deviceId" class="weui-input" style="font-size: 30px" type="number" pattern="[0-9]*" placeholder="设备认证号码" />
            </div> -->



            <div class="center-in-bottom2">
                <a class="weui-btn weui-btn_primary" style="width:100%" href="javascript:" id="register">注册</a>
            </div>



            <div class="weui-footer weui-footer_fixed-bottom">
            <p class="weui-footer__links">
                <p class="weui-footer__link">访问官网</p>
                <a href="http://www.zjnnhj.com" class="weui-footer__link">zjnnhj@zjnnhj.com</a>
            </p>
            <p class="weui-footer__links">
                <p class="weui-footer__link">联系我们</p>
                <a href="http://www.zjnnhj.com" class="weui-footer__link">18106532996</a>
            </p>
            <p class="weui-footer__text">Copyright © 2020 牛能环保</p>
            </div>


            
        </div>


        <script src="/static/js/jquery.min.js"></script>
        <script src="/static/js/weui.min.js"></script>
        <script type="text/javascript" src="/static/js/jweixin-1.4.0.js"></script>
        <script src="/static/js/zepto.min.js"></script>
        <script src="/static/js/example.js"></script>



        <script type="text/javascript">
            $(function() {

                function getQueryStringCODE(name) {
                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                    var r = decodeURI(window.location.search).substr(1).match(reg);
                    if (r != null) return (r[2]);
                    return null;
                };




                $(document).ready(function() {
                    // 获取code
                    var code = getQueryStringCODE('code');
                    var deviceId = getQueryStringCODE('device');
                    var commuNum = getQueryStringCODE('community');
                    var cerNum = getQueryStringCODE('cerNum');

                    // 认证号码
                    if (cerNum){
                        $('#cerNumber').attr('value', cerNum);
                    }
                    /*if (deviceId){
                        $('#deviceId').attr('value', deviceId);

                    }
                    if (commuNum){
                        $('#commuNum').attr('value', commuNum);
                    }*/

                   $('#register').on('click', function(){
                        //获取值
                        var cerN = $('#cerNumber').val();
                        var deviceN = deviceId;//$('#deviceId').val();
                        var commuN = commuNum;//$('#commuNum').val();
                        alert(code);
                        

                        if ( !cerN ){
                            alert('输入有误，请检查输入')
                        }else{
                            // 跳转注册
                            var fredirect_uri = 'http://gzh.zjnnhj.com/niuneng/toRegister.html?&device=' + deviceN + '&passwd=' + cerN + '&area=' + commuN;
                            //var fredirect_uri = 'http://gzh.zjnnhj.com/niuneng/toRegister.html?&passwd=' + cerN ;
                            var ffurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx5f2850581e4e064d&redirect_uri=" + encodeURIComponent(fredirect_uri) + "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
                            location.href = ffurl;
                            

                        }
                        
                    });

                });
            });
        </script>

    </script>
</body>

</html>
